package com.hsy.order.base.ui.widget

import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.util.SparseArrayCompat
import com.hsy.order.order.ui.ListFragment

/**
 * Created on 2018/3/28.
 *
 * @author Yang
 */
class FragmentAdapter(fm: FragmentManager, private val fragments: SparseArrayCompat<ListFragment>, private val titles: Array<String>) : FragmentPagerAdapter(fm) {
    override fun getPageTitle(position: Int): CharSequence = titles[position]
    override fun getItem(position: Int) = fragments.get(position)!!
    override fun getCount(): Int = fragments.size()
}